//
//  Circle.m
//  画圆
//
//  Created by boom on 2017/5/3.
//  Copyright © 2017年 boomLi. All rights reserved.
//

#import "Circle.h"

@implementation Circle

-(void)drawRect:(CGRect)rect{
    //圆形
//    UIBezierPath * aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake([UIScreen mainScreen].bounds.size.width * 0.5, [UIScreen mainScreen].bounds.size.height * 0.5) radius:[UIScreen mainScreen].bounds.size.width * 0.5 - 10 startAngle:0 endAngle:2 * M_PI clockwise:YES];
    
    //矩形
//    UIBezierPath * aPath = [UIBezierPath bezierPathWithRect:CGRectMake(100, 100, 100, 100)];
    
//    UIBezierPath * aPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(100, 100, 100, 100) cornerRadius:50];
    
//    aPath.lineWidth = 5;
//    
//    UIColor * color = [UIColor cyanColor];
//    [color set];
//    
//    [aPath stroke];
    
//    CAShapeLayer * layer = [[CAShapeLayer alloc] init];
//    layer.path = (__bridge CGPathRef _Nullable)(aPath);
//    layer.strokeColor = (__bridge CGColorRef _Nullable)([UIColor greenColor]);
//    layer.fillColor = (__bridge CGColorRef _Nullable)([UIColor yellowColor]);
//    [self.layer addSublayer:layer];
    
    NSLog(@"进入");
    //半径
    CGFloat redbius =40;
    //开始角度
    CGFloat startAngle = 0;
    //中心点
    CGRect CGFrome =[UIScreen mainScreen].bounds;
    
    CGFloat CGfrom_x=CGFrome.size.width-60;
    
    CGPoint point = CGPointMake(CGfrom_x/2, CGfrom_x/2);
    //结束角
    CGFloat endAngle = 2*M_PI;
    
    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:point radius:redbius startAngle:startAngle endAngle:endAngle clockwise:YES];
    layer1 = [[CAShapeLayer alloc] init];
    layer1.path=path.CGPath;   //添加路径
    layer1.strokeColor=[UIColor colorWithRed:100 green:191 blue:255 alpha:1.0].CGColor;
    layer1.fillColor=[UIColor colorWithRed:0 green:191 blue:255 alpha:1.0].CGColor;
    layer1.strokeStart = 0;
    
    [self.layer addSublayer:layer1];
    
    
}



@end
